/*
 * =================================================================
 *
 *       Filename:  1137.c
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  02/24/2011 09:02:15 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Richard Ma (richard_ma), richard.ma.19850509@gmail.com
 *        Company:  Feng Huli Primary School
 *
 * =================================================================
 */


#include	<stdlib.h>
#include	<stdio.h>
#include	<string.h>

/* 
 * ===  FUNCTION  ==============================================================
 *         Name:  main
 *  Description:  
 * =============================================================================
 */
    int
main ( int argc, char *argv[] )
{
    int n, m, i, j, start, end, max, a[100001];
    char str[16];

    scanf("%d", &n);
    for (i=0; i<=n; i++) a[i] = 0;
    scanf("%d", &m);
    for (i=0; i<m; i++) {
        scanf("%s %d %d", str, &start, &end);

        if (str[0] == 'C') {
            for (j=start; j<=end; j++) a[j]++;
        } else {
            max = 0;
            for (j=start; j<=end; j++) {
                if (a[j] > max) max = a[j];
            }
            printf("%d\n", max);
        }
    }

    return EXIT_SUCCESS;
}				/* ----------  end of function main  ---------- */

